'use strict'

/**
 * 首页推荐表
 * @param {*} app 
 * @returns 
 */
module.exports = app => {
  const { sequelize, DataTypes } = app
  const { STRING, INTEGER, DECIMAL } = DataTypes
  const tableName = 'recommend'

  const Recommend = sequelize.define(tableName, {
    recommend_id: { 
      type: INTEGER(20),
      primaryKey: true,
      autoIncrement: true
    },
    image_url: { type: STRING(255) },
    description: { type: STRING(255) },
    detail: { type: STRING(255) },
    price: { type: DECIMAL(10) },
    sort: { type: INTEGER(255) },
    status: { type: INTEGER(1) },
    // created_at: { // 默认已添加createdAt
    //   type: DATE,
    // },
    // updated_at: {
    //   type: DATE,
    // },
  }, {
    tableName,
    comment: '首页推荐表'
  })

  return Recommend
}